package com.googlecode.wstester.handlers

import com.googlecode.wstester.config.RequestConfig
import com.googlecode.wstester.config.utils.{Velocity, PlainXML}
import utils.Send
import xml.XML

/**
 * Created by IntelliJ IDEA.
 * User: pablo
 * Date: 2010-07-05
 * Time: 12:24:02
 */

class SimpleTestHandler(var requestConfig : RequestConfig, var testDirName: String) {
  def performRequest = {
    requestConfig.requestType match {
      case t: PlainXML => {
        val request = XML.load(testDirName+"/"+requestConfig.requestFileName);
        val requesthandler = new RequestHandler(request.toString);
        requesthandler ! Send;
      }
      case t: Velocity => {

      }
      case _ => throw new IllegalArgumentException("Unknown request type");
    }
  }
}